#pragma once

#include "HashTable.h"

template<class K, class Hash = HashFunc<K>>
class unordered_set
{
	struct KeyOfT
	{
		const K& operator() (const K& key)
		{
			return key;
		}
	};

public:
	typedef typename hash_buket::hashtable<K, const K, KeyOfT, Hash>::iterator iterator;

	pair<iterator, bool> insert(const K& key)
	{
		return _ht.insert(key);
	}

	bool erase(const K& key)
	{
		return _ht.erase(key);
	}

	iterator begin()
	{
		return _ht.begin();
	}

	iterator end()
	{
		return _ht.end();
	}

	bool count(const K& key) const
	{
		iterator ret = _ht.find(key);

		return !(ret == end());
	}

	size_t size() const
	{
		return _ht._n;
	}

	bool empty()
	{
		return _ht.empty();
	}

private:
	hash_buket::hashtable<K, const K, KeyOfT, Hash> _ht;
};
